var reports_db = []
var core_reports = $("ul.gallup_directory_core_reports li div");
var other_reports = $("ul.gallup_directory_library_list li div");
var dashboard_group = $("#idHeaderTitleCell").text();

core_reports.each(function(report){
report = $(core_reports[report]);
var title = report.find("a").text().trim();
var link = report.find("a").attr('href').trim();
var purpose = report.find("p").text().trim();
var report_type = "core";
var tags = []
tag_soup = report.find('.gallup_directory_report_tags li');
tag_soup.each(function(tag){
tags.push($(tag_soup[tag]).text().trim());
});
reports_db.push({"title":title,"link":link,"purpose":purpose,"dashboard_group":dashboard_group,"report_type":report_type,"tags":tags});
});

other_reports.each(function(report){
report = $(other_reports[report]);
var title = report.find("a").text().trim();
var link = report.find("a").attr('href').trim();
var purpose = report.find("p").text().trim();
var report_type = "library";
var tags = []
tag_soup = report.find('.gallup_directory_report_tags li');
tag_soup.each(function(tag){
tags.push($(tag_soup[tag]).text().trim());
});
reports_db.push({"title":title,"link":link,"purpose":purpose,"dashboard_group":dashboard_group,"report_type":report_type,"tags":tags});
});
window.clipboardData.setData('Text',JSON.stringify(reports_db));
alert('Copied reports dump to clipboard.')
